<template>
  <el-dialog
      v-if="visible"
      v-model="visible"
      @update:model-value="dialogVisible = $event"
      :title="title"
    :close-on-click-modal = "false"
    @close="()=>{}"
      :width="width">
    <component :is="com" @close="handleClose" :initParams="initParams"></component>
  </el-dialog>
</template>
<script>
import{reactive, defineComponent,ref} from 'vue';
 export default defineComponent({
   props:{
     title:String,
     width: {
       type:Number,
       default: 500
     },
     url:String
   },
   setup(props,context) {
    const {slots, attrs, emit, expose} = context;
     const com=ref(null);
     const visible =ref(false)
     const initParams =ref(null)
     const open =(params)=>{
       loadVue(props.url,(m)=>{
         com.value=m;
         visible.value=true;
         initParams.value = params;
       })
     }
     const handleClose=(params)=>{
        visible.value=false
        emit('onclose',params)
     }

     return {open,com,visible,handleClose,initParams}
   }


 })


</script>